
/**
 * 仿今日头条有新消息时的顶部弹窗
 */

import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';

class CustomTopWidget extends StatefulWidget {
  final CancelFunc cancelFunc;
  final String title;
  final String subTitle;
  final int id;

  const CustomTopWidget({Key key, this.cancelFunc, this.title, this.subTitle, this.id}) : super(key: key);

  @override
  CustomTopWidgetState createState() => CustomTopWidgetState();
}

class CustomTopWidgetState extends State<CustomTopWidget> {
  

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        print('点击消息事件');
        widget.cancelFunc();
      },
      child: Container(
        height: 116,
        margin: EdgeInsets.all(10),
        padding: EdgeInsets.all(10),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.all(Radius.circular(8.0)),
          boxShadow: <BoxShadow>[//设置阴影
            new BoxShadow(
              color: Colors.black12,
              offset: Offset(0.0, 10.0), //阴影xy轴偏移量
              blurRadius: 15.0, //阴影模糊程度
              spreadRadius: 1.0 //阴影扩散程度
            ),
          ]
        ),
        child: Column(
          children: <Widget>[
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Container(
                  child: Row(
                    children: <Widget>[
                      Image.asset('assets/images/img/logo.png', width: 20,height: 20,),
                      SizedBox(width: 5,),
                      Text('天上人间', style: TextStyle(color: Color(0xff333333), fontSize: 14),)
                    ],
                  ),
                ),
                Text('现在', style: TextStyle(color: Color(0xff333333), fontSize: 14),)
              ],
            ),
            SizedBox(height: 5,),
            Container(
              width: double.infinity,
              child: Text('快讯', style: TextStyle(fontSize: 15, color: Color(0xff000000)),overflow: TextOverflow.ellipsis,),
            ),
            Container(
              width: double.infinity,
              child: Text('针对上面提到的会堵住子Widget和切角问题针对上面提到的会堵住子Widget和切角问题针对上面提到的会堵住子Widget和切角问题针对上面提到的会堵住子Widget和切角问题', style: TextStyle(fontSize: 15, color: Color(0xff333333)),overflow: TextOverflow.ellipsis,maxLines: 2),
            )
          ],
        ),
      ),
    );
  }
}